package org.abio.XasML.core
{
	import flash.display.Sprite;
	import flash.utils.*;
	
	import org.abio.XasML.converter.*;
	import org.abio.XasML.event.DependencyObjectEvent;
	import org.abio.XasML.reflect.*;
	
	[Event(name="initialize", type="org.abio.XasML.event.DependencyObjectEvent")]
	public dynamic class DependencyObject extends Sprite
	{
		private var xml:XML=null;
		
		public var id:String='';

		public function DependencyObject()
		{
			this.registerConverter(Function, object2Function);
			this.registerConverter(Class, object2Class);
			this.registerConverter(Boolean, object2Boolean);
			
			this.addEventListener(DependencyObjectEvent.INITIALIZE, INITIALIZE);
		}

		private var Converter:Dictionary=new Dictionary();
		protected function registerConverter(target:Object, func:Function):void{
			this.Converter[target]=func;
		}

		private function INITIALIZE(e:DependencyObjectEvent):void{
			for(var str:String in this){
				trace(str, this[str]);
			}
		}
		
		public function revalidate():void{
			trace('revalidate', this.id);
		}
	}
}
